package com.LearnInWorld.exception;

import com.LearnInWorld.entity.StatusCode;

/**
 * 自定义异常类
 */
public class CustomException extends RuntimeException {

    private boolean flag;//是否成功
    private Integer code;//返回码
    private String message;//返回消息

    public CustomException(boolean flag,Integer code,String message) {
        this.code=code;
        this.flag=flag;
        this.message=message;
    }

    public CustomException(String message){
        this.flag=false;
        this.code= StatusCode.ERROR;
        this.message=message;
    }

    public CustomException() {
    }

    public boolean isFlag() {
        return flag;
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
